/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package net.com.hydroPK.model.skills.runeCrafting;

import net.com.hydroPK.*;
import net.com.hydroPK.model.*;

/**
 *
 * @author Zack
 */
public class runecrafting {

    private int ess;
    public static void runecrafting(Player p, int level, int XP, int rune, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10)
    {
         int ess = Engine.playerItems.invItemCount(p, 1436);
         int lvl = 1;
         p.clickId = p.stream.readUnsignedWord();
         if (p.skillLvl[20] < lvl)
         {
             p.getActionSender().sendMessage(p, "You need at least "+ lvl +" to runecraft this.");
             return;
         }
         if (!Engine.playerItems.haveItem(p, 1436)) {
                 p.getActionSender().sendMessage(p, "you need Rune Essence to Craft this!");
                 return;
         }
         if (p.skillLvl[20] >= lvl)
         {
			if (p.skillLvl[20] >= a2 && p.skillLvl[20] < a3)
				ess = Engine.playerItems.invItemCount(p, 1436)*2;
			if (p.skillLvl[20] >= a3 && p.skillLvl[20] < a4)
				ess = Engine.playerItems.invItemCount(p, 1436)*3;
			if (p.skillLvl[20] >= a4 && p.skillLvl[20] < a5)
				ess = Engine.playerItems.invItemCount(p,1436)*4;
			if (p.skillLvl[20] >= a5 && p.skillLvl[20] < a6)
				ess = Engine.playerItems.invItemCount(p,1436)*5;
			if (p.skillLvl[20] >= a6 && p.skillLvl[20] < a7)
				ess = Engine.playerItems.invItemCount(p,1436)*6;
			if (p.skillLvl[20] >= a7 && p.skillLvl[20] < a8)
				ess = Engine.playerItems.invItemCount(p,1436)*7;
			if (p.skillLvl[20] >= a8 && p.skillLvl[20] < a9)
				ess = Engine.playerItems.invItemCount(p,1436)*8;
			if (p.skillLvl[20] >= a9 && p.skillLvl[20] < a10)
				ess = Engine.playerItems.invItemCount(p,1436)*9;
			if (p.skillLvl[20] >= a10)
				ess = Engine.playerItems.invItemCount(p,1436)*10;

		}
         for (int i = 0; i < 29; i++)
             Engine.playerItems.deleteItem(p, 1436, Engine.playerItems.getItemSlot(p,1436), i);
             Engine.playerItems.addItem(p, rune, ess);
             p.appendExperience(XP*ess, 20);
             p.requestAnim(791, 0);
}
}
